[+:   -*- Mode: nroff -*- 
 AutoGen5 template man=%s.1M                           :+][+:

	# * * * * * * * * * * * * * * * * * * * * * * * * *
	#Start  : temporary folders
	# * * * * * * * * * * * * * * * * * * * * * * * * *
				
				                       :+][+:
 (make-tmp-dir)                                        :+][+:

	# * * * * * * * * * * * * * * * * * * * * * * * * *
	#End   : temporary folders
	#Start : definition
	# * * * * * * * * * * * * * * * * * * * * * * * * *

				                       :+][+:
 
 (define prog-name (string-downcase! (get "prog-name")))
 (define PROG_NAME (string-tr! (get "prog-name") "a-z^-" "A-Z__"))
 (define prog_name (string-tr! (get "prog-name") "A-Z^-" "a-z__"))  
 (define detail-file (string-append tmp-dir "/detail"))

						       :+][+:

	# * * * * * * * * * * * * * * * * * * * * * * * * *
	#End   : definition
	#Start : environment variable setting
	# * * * * * * * * * * * * * * * * * * * * * * * * *

				                       :+][+:

 (setenv "SHELL" "/bin/sh") 
						       :+][+:

	# * * * * * * * * * * * * * * * * * * * * * * * * *	
	#End   : environment variable setting
	#Start : Month day, year
	# * * * * * * * * * * * * * * * * * * * * * * * * *

				                       :+].Dd [+:

 `date +%Y-%m-%d` 

						       :+][+:

	# * * * * * * * * * * * * * * * * * * * * * * * * *	
	#End   : Month day, year
	#Start : [OPERATING_SYSTEM] [version/release]
	# * * * * * * * * * * * * * * * * * * * * * * * * *

				                       :+]
[+:
 % package (string-append ".Os " (string-upcase! "%s")):+][+:

	# * * * * * * * * * * * * * * * * * * * * * * * * *	
	#End   : [OPERATING_SYSTEM] [version/release]
	#Start : DOCUMENT_TITLE [section number] [architecture/volume]
	# * * * * * * * * * * * * * * * * * * * * * * * * *

				                       :+][+:
 % prog-name (string-append "\n" ".Dt " (string-upcase! "%s ") (get "manual-section")) 
						       :+][+:

	# * * * * * * * * * * * * * * * * * * * * * * * * *	
	#End   : [OPERATING_SYSTEM] [version/release]
	#Start : NAME
	# * * * * * * * * * * * * * * * * * * * * * * * * *

				                       :+]
.Sh NAME
[+:
 % prog-name (string-append ".Nm " "%s")               :+][+:

 % prog-title (string-append "\n" ".Nd " "%s")  

						       :+][+:

	# * * * * * * * * * * * * * * * * * * * * * * * * *	
	#End   : NAME
	#Start : dne argument
	# * * * * * * * * * * * * * * * * * * * * * * * * *

				                       :+]
[+:

;; The following "dne" argument is a string of 5 characters:
;; '.' '\\' '"' and two spaces.  It _is_ hard to read.
;;
(dne ".\\\"  ") :+][+:  # balance quotes for emacs: "

						       :+][+:

	# * * * * * * * * * * * * * * * * * * * * * * * * *	
	#End   : NAME
	#Start : dne argument
	# * * * * * * * * * * * * * * * * * * * * * * * * *

				                       :+]
.Sh SYNOPSIS
[+:
  IF (exist? "argument") 	                  :+][+:
% argument       (string-append ".Nm " " %s"      ):+][+:
  ELSE						  :+][+:
% prog-name      (string-append ".Nm " " %s"      ):+][+:
  ENDIF						  :+][+:
  FOR flag					  :+][+:
% value  (string-append "\n" ".Op Fl " " %s " "Ar " (get "argument")):+][+:
  ENDFOR					  :+][+:	

	# * * * * * * * * * * * * * * * * * * * * * * * * *
	#End   : SYNOPSIS
	#Start : DESCRIPTION
	# * * * * * * * * * * * * * * * * * * * * * * * * *

						  :+]
.Sh DESCRIPTION
[+:
IF   (exist? "prog-mdoc-descrip ") :+][+:
  FOR prog-mdoc-descrip  "\n\n"    :+][+:
    prog-mdoc-descrip              :+][+:
  ENDFOR                           :+][+:
ELIF (exist? "prog-man-descrip ")  :+][+:
  (out-push-new detail-file)       :+][+:
  FOR prog-man-descrip "\n\n"      :+][+:
    prog-man-descrip 	           :+][+:
  ENDFOR			   :+][+:
ELIF (exist? "prog-info-descrip ") :+][+:
  (out-push-new detail-file)       :+][+:
  FOR prog-info-descrip  "\n\n"    :+][+:
    prog-info-descrip              :+][+:
  ENDFOR			   :+][+:
ENDIF
:+][+:
IF   (exist? "prog-man-descrip ") :+][+:
  (out-pop)		          :+][+:
  (shellf "perl %s < %s" (find-file "man2mdoc.pl") detail-file)      :+][+:
ELIF (exist? "prog-info-descrip") :+][+:
  (out-pop)		          :+][+:
  (shellf "perl %s < %s" (find-file "texi2mdoc.pl") detail-file)     :+][+:
ENDIF
:+]
.Sh FILES
[+:
IF   (exist? "prog-mdoc-files ") :+][+:
  FOR prog-mdoc-files  "\n\n"    :+][+:
    prog-mdoc-files              :+][+:
  ENDFOR                         :+][+:
ELIF (exist? "prog-man-files ")  :+][+:
  (out-push-new detail-file)     :+][+:
  FOR prog-man-files "\n\n"      :+][+:
    prog-man-files 	         :+][+:
  ENDFOR			 :+][+:
ELIF (exist? "prog-info-files ") :+][+:
  (out-push-new detail-file)     :+][+:
  FOR prog-info-files  "\n\n"    :+][+:
    prog-info-files              :+][+:
  ENDFOR			 :+][+:
ENDIF
:+][+:
IF   (exist? "prog-man-files ") :+][+:
  (out-pop)		          :+][+:
  (shellf "perl %s < %s" (find-file "man2mdoc.pl") detail-file)     :+][+:
ELIF (exist? "prog-info-files")  :+][+:
  (out-pop)		         :+][+:
  (shellf "perl %s < %s" (find-file "texi2mdoc.pl") detail-file)    :+][+:
ENDIF
:+]
.Sh SEE ALSO
[+:
IF   (exist? "prog-mdoc-see-also ") :+][+:
  FOR prog-mdoc-see-also  "\n\n"    :+][+:
    prog-mdoc-see-also              :+][+:
  ENDFOR                            :+][+:
ELIF (exist? "prog-man-see-also ")  :+][+:
  (out-push-new detail-file)        :+][+:
  FOR prog-man-see-also "\n\n"      :+][+:
    prog-man-see-also 	            :+][+:
  ENDFOR			    :+][+:
ELIF (exist? "prog-info-see-also ") :+][+:
  (out-push-new detail-file)        :+][+:
  FOR prog-info-see-also  "\n\n"    :+][+:
    prog-info-see-also              :+][+:
  ENDFOR			    :+][+:
ENDIF
:+][+:
IF   (exist? "prog-man-see-also ") :+][+:
  (out-pop)		           :+][+:
  (shellf "perl %s < %s" (find-file "man2mdoc.pl") detail-file)     :+][+:
ELIF (exist? "prog-info-see-also") :+][+:
  (out-pop)		           :+][+:
  (shellf "perl %s < %s" (find-file "texi2mdoc.pl") detail-file)    :+][+:
ENDIF
:+]
.Sh BUGS
[+:
IF   (exist? "prog-mdoc-bug")     :+][+:
  FOR prog-mdoc-bug  "\n\n"       :+][+:
    prog-mdoc-bug                 :+][+:
  ENDFOR                          :+][+:
ELIF (exist? "prog-man-bug")      :+][+:
  (out-push-new detail-file)      :+][+:
  FOR prog-man-bug "\n\n"         :+][+:
    prog-man-bug 	          :+][+:
  ENDFOR			  :+][+:
ELIF (exist? "prog-info-bug")     :+][+:
  (out-push-new detail-file)      :+][+:
  FOR prog-info-bug  "\n\n"       :+][+:
    prog-info-bug                 :+][+:
  ENDFOR			  :+][+:
ENDIF
:+][+:
IF   (exist? "prog-man-bug")      :+][+:
  (out-pop)		          :+][+:
  (shellf "perl %s < %s" (find-file "man2mdoc.pl") detail-file)      :+][+:
ELIF (exist? "prog-info-bug")     :+][+:
  (out-pop)		          :+][+:
  (shellf "perl %s < %s" (find-file "texi2mdoc.pl") detail-file)     :+][+:
ENDIF
:+]
